//
//  TemplateClass.cpp
//  HelloWorld
//
//  Created by Kevin Tang on 11/12/14.
//  Copyright (c) 2014年 Kevin Tang. All rights reserved.
//
#include <iostream>
#include "Common.h"
#include "TemplateClass.h"

int templateClass_test()
{
    int a=7;
    Stack<int> IntStack;//调用默认构造方法
    Stack<std::string> StringStack;
    try {
        
        IntStack.push(a);
        std::cout<<IntStack.top()<<std::endl;
        
        StringStack.push("Hello");
        std::cout<<StringStack.top()<<std::endl;
        StringStack.pop();
       // StringStack.pop();//打开就会产生异常抛出
        
    } catch (std::exception const& ex) {
        std::cerr << "Exception:"<<ex.what()<<std::endl;
        return EXIT_FAILURE;
    }
    
    
    OtherClass<int [] > b(a);
    
    b.setInt(3);
    std::cout<<b.getInt()<<std::endl;
    
    return EXIT_SUCCESS;
}
